package umg;

import java.util.HashMap;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
	private static final String BUNDLE_NAME = "umg.messages";

	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);

	private static HashMap<String, String> messagesHashMap = new HashMap<String, String>(400);

	static String tmpStr = null;

	public static String getString(String key)
	{
		try
		{
			if (messagesHashMap.containsKey(key)) return messagesHashMap.get(key);
			else
			{
				tmpStr = RESOURCE_BUNDLE.getString(key);
				messagesHashMap.put(key, tmpStr);
				return tmpStr;
			}
		}
		catch (MissingResourceException e)
		{
			return '!' + key + '!';
		}
	}
}
